package com.wcs.exam.controller.api;

import com.wcs.exam.common.base.Result;
import com.wcs.exam.controller.api.biz.ApiCategoryBiz;
import com.wcs.exam.controller.api.resp.ApiCategoryResp;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Api-分类
 *
 * @author wcs
 * @since 2025-03-11
 */
@Tag(name = "Api-分类")
@RestController
@RequiredArgsConstructor
@RequestMapping("/v1/api/category")
public class ApiCategoryController {

    @NotNull
    private final ApiCategoryBiz biz;

    @Operation(summary = "分类列表")
    @Parameter(name = "categoryType", description = "类型(1:通用、2:试题、3:试卷)", schema = @Schema(defaultValue = "1", allowableValues = {"1", "2", "3", "4"}))
    @GetMapping(value = "/list")
    public Result<List<ApiCategoryResp>> list(@RequestParam(defaultValue = "1") String categoryType) {
        return biz.list(categoryType);
    }

}
